Skip to content

zizmor: Full security lint of publish-to-pypi.yml - #2107

Closed
cclauss wants to merge 1 commit into
pypa:mainfrom
cclauss:zizmor-publish-to-pypi.yml
Closed

zizmor: Full security lint of publish-to-pypi.yml#2107
cclauss wants to merge 1 commit into
pypa:mainfrom
cclauss:zizmor-publish-to-pypi.yml

Conversation

@cclauss

@cclauss cclauss commented Aug 15, 2026

Copy link
Copy Markdown

A superset of #2106 that passes zizmor security linting checks.

@webknjaz Your review, please.


📚 Documentation preview 📚: https://python-packaging-user-guide--2107.org.readthedocs.build/en/2107/

@cclauss
cclauss requested a review from webknjaz as a code owner August 15, 2026 08:45

@webknjaz webknjaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest is not acceptable, though, no, same as #2106.

name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push
permissions: {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one might be okay provided the build job also lists the exact privileges required and the PR is scoped to only adding permissions: to examples.
Also, add one empty-line separator above.

@cclauss

cclauss commented Aug 15, 2026

Copy link
Copy Markdown
Author

Closing in favor of #2106 because we want to keep the uses: pypa/gh-action-pypi-publish@release/v1 syntax.

@cclauss cclauss closed this Aug 15, 2026
@cclauss
cclauss deleted the zizmor-publish-to-pypi.yml branch August 15, 2026 13:56
@webknjaz

Copy link
Copy Markdown
Member

@cclauss it's probably still a good idea to tell users to use Zizmor in some tip admonition in the guide, though, if it still doesn't do that. One important thing that people miss in my experience is separating the publishing and the building jobs, though. Showing different explicit permissions might be a good hint for them. Unfortunately, it seems like they tend to copy their examples from some weird projects on the internet that already don't follow this recommendation.

@cclauss

cclauss commented Aug 15, 2026

Copy link
Copy Markdown
Author

I find excessive-permissions to be the Zizmor rule I am least confident about proposing solutions for. It is helpful that the excessive-permissions example covers these GitHub Actions.

I agree that bad examples abound, but I believe that these samples should be the source of truth for visitors.

If this repo were to adopt Dependabot for GitHub Actions with a 7-day cooldown plus full Zizmor, then these samples could be best-practice examples that use current actions and pass Zizmor.

I know this is more PRs for maintainers to review and merge, but at least visitors would not be misled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants